﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminSite.Master"
    Inherits="System.Web.Mvc.ViewPage<HYBYSoft.Company.Models.Article>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Create
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script src="<%: Url.Content("~/Scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
    <script src="<%: Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js") %>"
        type="text/javascript"></script>
    <script src="../../../../Scripts/kindeditor-4.0.4/kindeditor-min.js" type="text/javascript"></script>
    <script src="../../../../Scripts/kindeditor-4.0.4/kindeditor.js" type="text/javascript"></script>
    <script src="../../../../Scripts/kindeditor-4.0.4/lang/zh_CN.js" type="text/javascript"></script>
    <link href="../../../../Scripts/kindeditor-4.0.4/plugins/code/prettify.css" rel="stylesheet"
        type="text/css" />
    <link href="../../../../Scripts/kindeditor-4.0.4/themes/default/default.css" rel="stylesheet"
        type="text/css" />
    <script type="text/javascript">
        KindEditor.ready(function (K) {
            var editor1 = K.create('#contents', {
                cssPath: '../../../../Scripts/kindeditor-4.0.4/plugins/code/prettify.css',
                uploadJson: '../../../../Scripts/kindeditor-4.0.4/asp.net/upload_json.ashx',
                fileManagerJson: '../../../../Scripts/kindeditor-4.0.4/asp.net/file_manager_json.ashx',
                allowUpload: true,
                allowFileManager: true,
                afterCreate: function () {
                    var self = this;
                    K.ctrl(document, 13, function () {
                        self.sync();
                        K('form[name=example]')[0].submit();
                    });
                    K.ctrl(self.edit.doc, 13, function () {
                        self.sync();
                        K('form[name=example]')[0].submit();
                    });
                }
            });
            prettyPrint();
        });
    </script>
    <div id="content">
    <span id="sitemap">当前位置：文章新建</span>
        <% using (Html.BeginForm("Create", "Article", FormMethod.Post, new { enctype = "multipart/form-data" }))
           { %>
        <%: Html.ValidationSummary(true) %>
        <fieldset id="article-fieldset" style="width: 840px; height:455px;">
            <legend>新增文章</legend>
            <div id="article-top">
                <div id="label-title">
                    <%: Html.LabelFor(model => model.Title) %>:
                </div>
                <div id="text-title">
                    <%: Html.TextBoxFor(model => model.Title ,new { style = "width:280px;" })%>
                    <%: Html.ValidationMessageFor(model => model.Title)%>
                </div>
                <div id="categorylist" >
                    分类：
                    <%=Html.DropDownList("ddlCategoryName", (IEnumerable<SelectListItem>)ViewData["categoryName"], new { style = "width:100px;margin-right:7px" })%>
                </div>
            </div>
            <div>
                <div id="article-content">
                    <%:Html.TextAreaFor(model => model.Contents, new { id = "contents", style = "width:820px; height:220px" })%>
                </div>
            </div>
            <div>
                <div id="label-icon">
                    <div style="float: left;">
                        <%: Html.LabelFor(model => model.Icon) %>：
                    </div>
                    <div style="float: left;">
                        <input name="FileUpload1" type="file" />
                    </div>
                </div>
                <div id="lable-description">
                    <%: Html.LabelFor(model => model.Description) %>：
                </div>
                <div id="text-description">
                    <%: Html.TextAreaFor(model => model.Description, new { style = "width:760px;height:80px;" })%>
                    <%: Html.ValidationMessageFor(model => model.Description) %>
                </div>
            </div>
            <br />
            <center>
                <input type="submit" value="新增文章" />
            </center>
        </fieldset>
        <% } %>
        <p>
            <%: Html.ActionLink("返回列表", "Index", new { page = ViewBag.PageId })%>
        </p>
    </div>
</asp:Content>
